<?php


namespace app\common\model;


use think\Model;

class MoneyTixian extends Model
{
    //  查询
    public static function indexShow($map, $order, $size='10', $field = "*")
    {
        return MoneyTixian::where($map)->where('gong_tx_s','=','null')
            ->order($order)
            ->field($field)
            ->paginate($size, false, ['query' => request()->param()]);
    }

    public static function show($map, $order, $size='10', $field = "*")
    {
        return MoneyTixian::where($map)
            ->order($order)
            ->field($field)
            ->paginate($size, false, ['query' => request()->param()]);
    }

    // 查询
    public static function gongShow($map, $order, $size='10', $field = "*")
    {
        return MoneyTixian::where($map)->where('gong_tx_s','=',2)
            ->order($order)
            ->field($field)
            ->paginate($size, false, ['query' => request()->param()]);
    }

    public static function num($map)
    {
        return MoneyTixian::where($map)->sum('tx_num');
    }

    public static function indexNum($map)
    {
        return MoneyTixian::where($map)->where('gong_tx_s','=','null')->sum('tx_num');
    }

    public static function gongNum($map)
    {
        return MoneyTixian::where($map)->where('gong_tx_s','=',2)->sum('tx_num');
    }

    // 运营中心查询
    public function selects($map, $order, $size, $field = "*")
    {
        $list = $this
            //->alias('a')
            //->join('user b','a.us_id = b.id','LEFT')
            ->where($map)
            ->where('tx_zhongxing','=',2)
            ->order($order)
            ->field($field)
            ->paginate($size,false,['query'=>request()->param()]);
        return $list;
    }



}